"""
# pytest tests/ShapePhysics_test.py
物理碰撞算法测试

- 测试算法:
    - AABB
    - GJK
"""
from ShapePhysics import ShapeBase, BoxCheck, GJKCheck, Simplex, np


if __name__ == '__main__':
    aa = 2 * np.array([
        [1, 1],
        [-1, 1],
        [-1, -1],
        [1, -1],
    ])
    bb = np.array([
        [1.7, 0],
        [3, 3],
        [3, -3],
    ])

    # --- test
    aa: ShapeBase = ShapeBase(aa)
    bb: ShapeBase = ShapeBase(bb)

    simp = Simplex()  # 记录包含原点的单纯形, 用EPA来反推碰撞向量
    is_collision = GJKCheck(aa, bb, simp)
    print('--- is_collision: ', is_collision)